
const state = {
    popup: {},
    loading: {},
    readDurationMs: 5000
}
const getters = {
    //获取弹窗对象
    getPopup: state => state.popup,
    //获取加载页对象
    getLoading: state => state.loading,
    //获取请求间隔
    getReadDurationMs: state => state.readDurationMs
}
const mutations = {
    //设置弹窗
    setPopup(state, param) {
        const resultOption = $.extend({
            "isShow": true,     //是否显示
            "closeIsShow": true, //是否显示取消按钮
            "content": "",     //内容
            "title": "提示",     //标题
            "botton": "确定",    //按钮标题
            "router": "",     //跳转的路由
            "callback": null   //回调事件
        }, param)
        state.popup = resultOption
    },
    //设置加载页
    setLoading(state, param) {
        const resultOption = $.extend({
            "isShow": true,     //是否显示
            "isBackground": false, //是否显示背景
            "content": "",     //内容
            "isProgress": false,     //是否开启进度条
            "progressCount": 0,//进度条进度
            "router": "", //跳转的路由
            "callback": null   //回调事件
        }, param)
        state.loading = resultOption
    },
    //设置请求间隔
    setReadDurationMs(state, param) {
        state.readDurationMs = param
    }
}
const actions = {
    setPopup({ commit }, param) {
        commit("setPopup", param)
    },
    setLoading({ commit }, param) {
        commit("setLoading", param)
    },
    setReadDurationMs({ commit }, param) {
        commit("setReadDurationMs", param)
    }
}
export default {
    namespaced: true,//用于在全局引用此文件里的方法时标识这一个的文件名
    state,
    getters,
    mutations,
    actions
}